<template>
	<view class="home">
		<view class="commodityImages">
			<image :src="productInfo.productPic" mode="heightFix"></image>
			<!-- <image src="/static/tom.gif" mode=""></image> -->
		</view>
		
		<view class="btn" @click="goPage('/pages/index/commodityInfo')">点击查看商品追溯信息</view>
	</view>
</template>

<script>
	// 		 				产品信息	
	import {imgUrl,getProductInfo} from "../../api/api_test.js"
	export default {
		data() {
			return {
				id:'',
				batchNo:'',
				imgUrl:imgUrl,
				productInfo:{},
			}
		},
		onLoad(options) {
			console.log("options",options);
			this.id = options.id
			this.batchNo = options.batchNo
			uni.setStorageSync('id',this.id)
			uni.setStorageSync('batchNo',this.batchNo)
			
			
			this.getInfo()
		},
		methods: {
			getInfo(){
				getProductInfo(this.id,res=>{
					// console.log("res",res)
					if(res.code == 200){
						this.productInfo = res.data
						this.productInfo.productPic = this.imgUrl + this.productInfo.productPic
						// console.log("this.productInfo.productPic",this.productInfo.productPic)
					}
				})
			},
			goPage(url){
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home {
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		background: url(../../static/maizi.png) no-repeat;
		background-size: 100% 100% ;
		// background-image: linear-gradient(#A6DE55, #7CB32B);
		.commodityImages{
			margin-top: 200rpx;
			background: #fff;
			width: 480rpx;
			height: 480rpx;
			border-radius: 50%;
			overflow: hidden;
			image{
				width: 480rpx;
				height: 480rpx;
			}
		}
		
		.btn{
			width: 380rpx;
			height: 80rpx;
			border-radius: 10rpx;
			background: #80BF2A;
			color: #fff;
			line-height: 80rpx;
			text-align: center;
			margin-top: 300rpx;
			box-shadow: 0px 0px 6px 1px #888888;
			text-decoration: underline;
		}
	}

</style>
